@extends('layouts.header')
@section('content')
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 基础信息 <span class="c-gray en">&gt;</span>        微信通知管理
        <a class="btn btn-primary radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);"
            title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
    </nav>
    <div class="page-container">
        <div class="cl pd-5 bg-1 bk-gray">
            <span class="">
                <a href="javascript:;" onclick="layer_show('添加微信通知规则','add','','430')"
                    class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加微信通知规则</a>
            </span>
        </div>
        <div class="mt-20">
            <table class="table table-border table-bordered table-hover table-bg table-responsive" id="datatable">
                <thead>
                    <tr class="text-c">
                        <th>ID</th>
                        <th>微信通知名称</th>
                        <th>接收通知人员</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                @foreach($data as $item)
                    <tr class="text-c">
                        <td>{{$item->id}}</td>
                        <td>{{$item->name}}</td>
                        <td>{{$item->realname}}({{$item->username}})</td>
                        <td>
                            <a href="javascript:;" onclick="del(this,{{$item->id}})" class="ml-5 btn btn-danger-outline radius size-MINI" >删除</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>
    </div>
    <script type="text/javascript">
var table;
$(function(){
    $.fn.dataTable.ext.errMode = 'throw';//datatable抛异常的方式，在console中输出，默认以alert的方式弹出
    table = $('#datatable').DataTable({
        ordering: false, // 是否排序
        language: { url: '/admin/lib/datatables/dataTables_Chinese_Lang.json' },
    });

});

/*删除*/
function del(obj,id){
	layer.confirm('确认要删除吗？',{title:'信息',icon:3},function(index){
	    ajax('get','del', {id:id},delBak);
	    function delBak(res) {
           if(res == 1){
              $(obj).closest('tr').remove();
           }
        }
	});
}
    </script>
@endsection